A major objective in graphics rendering is to produce images that are so realistic that the observer believes the image is real. A fundamental difficulty in achieving total visual realism is the complexity of accurately representing real world visual effects. A scene can include a wide variety of textures, subtle color gradations, reflections, translucency, etc. One important way to make images more realistic is to determine how objects in a scene cast shadows and then represent these shadows in the rendered image. Shadows enhance the realism of an image because they give a two-dimensional image a three-dimensional feel.
The addition of shadows to the rendering of a complex model can greatly enhance the understanding of that model's geometry. The human visual system uses shadows as a cue for depth and shape. Consequently, shadows are very useful for conveying the three dimensional nature of rendered objects and for adding realism to computer generated scenes.
Generally, shadowing is similar to hidden surface removal. In hidden surface removal, objects or portions thereof are obscured because they are behind another object. For hidden surface removal, the point of reference for determining if an object is obscured is called a viewing point. For shadowing, objects or portions thereof are obscured because they are in the shadow of another object. In the shadowing case, the point of reference for determining if an object is obscured is a source light point. While many approaches exist for shadow mapping, depth map-based shadow algorithms are commonly used in graphics pipelines. Examples of such depth map-based shadow mapping algorithms are set forth in:    1) Lance Williams. Casting curved shadows on curved surfaces. In Proceedings of SIGGRAPH'78, pages 270–274, 1978;    2) Reeves, D. H. Salesin, R. L. Cook. Rendering antialiased shadows with depth maps. In Proceedings of SIGGRAPH'87, pages 283–291, 1987; and    3) M. Segal, C. Korobkin, R. van Widenfelt, J. Fordan, P. Haeberli. Fast Shadows and Lighting Effects Using Texture Mapping. In Proceedings of SIGGRAPH'92, pages 249–252, 1992.
which are each incorporated herein by reference in their entirety.
Prior Art FIG. 1 illustrates one depth map-based shadow algorithm 100 for generating realistic shadows. In such approach, there are two rendering passes 102 and 104. In the first pass 102, the scene is rendered from the point of view of a light source. The result is a depth map 106, or shadow map, which is essentially a two-dimensional function indicating the depth of the closest pixels to the light. In particular, each primitive, i.e. triangle, is scan-converted into pixels. A depth value, zlight, of the scanned fragment is interpolated across the primitive, and then is z-tested using a standard z-value (or any other depth value representation) buffer algorithm before being written out to the depth map 106. For additional information regarding such algorithm, reference may be made to the previously mentioned references in addition to: E. Catmull. A hidden surface Algorithm with Anti-Aliasing. In Siggraph '78, Page 6–11. 1978, which is incorporated herein by reference in its entirety.
Prior Art FIG. 2A illustrates the prior art technique 200 of building the shadow map using the standard z-buffer algorithm. As shown, distances 202 between a light source 204 and exposed surfaces of objects 206 are collected from a z-buffer. Depth values which are representative of the distances 202 are then utilized to generate the depth map 106.
For reasons that will soon become apparent, a polygon offset function may be performed in operation 108 for resolving a common self-shadowing aliasing problem. As an option, the polygon offset operation may include the “glPolygonOffset” operation in accordance with the OpenGL® programming language.
In the second pass 104, the scene is rendered from the eye space. During the second pass 104, each primitive is scanned into the screen from the eye space. However, the position (x,y,z) in the eye space can be transformed via a standard projective texture mapping operation 110 into the light space to get a texture coordinates (s,t,r), where (s,t) are the texture coordinates of the sampled three-dimensional point projected on the depth map 106, while r is the depth value that corresponds to the distance of the sampled point to the light source. In the second pass it is important to note that the distance value, r, can possibly be scaled by a percentage value, hence is offset by a small percentage amount using the texgen matrix or a vertex program.
Thereafter, in operation 112, the depth value at the sampling point, r, is then compared with the offset depth value, zlight, stored in the depth map 106 generated in the first pass 102 to yield a light-occlusion result, i.e. r>zlight, if the sampled point is behind some objects which are closer to the light, hence it is in the shadow of those objects. The resultant binary shadow values are then used to shade the current scanned object, resulting in shadow effects. Prior Art FIG. 2B illustrates the various variables associated with the calculations carried out during the second pass 104. Finally, a shadow modulation operation 114 is performed, the details of which will be set forth hereinafter.
Since this two-pass approach requires resampling the depth map 106 in the second pass 104, the problem of self-shadow aliasing may occur. Prior Art FIG. 2C illustrates such aliasing problem that arises when shadow mapping in accordance with Prior Art FIGS. 1–2B. In particular, complications arise when various points on the objects 206 are rendered in light space via a single texel 210 during the first pass 102, and subsequently rendered by way of separate pixels 212 in eye space during the second pass 104.
Prior Art FIG. 3A illustrates the offset operation 108 of Prior Art FIG. 1 which represents a solution to the aliasing problem of Prior Art FIG. 2C. As shown, the depth value, zlight, may be bounded by the “glPolygonOffset” operation. In particular, the “glPolygonOffset” operation includes calculating an offset value, o, using Prior Art Equations A.